package org.dromara.lessor.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore;
import lombok.RequiredArgsConstructor;
import org.dromara.admin.model.UserRegisterBody;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.domain.model.RegisterBody;
import org.dromara.lessor.service.ILessorRegisterService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 出租方注册控制器
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/lessor")
public class LessorRegisterController {

    private final ILessorRegisterService registerService;

    /**
     * 出租方注册
     */
//    @SaCheckPermission("all:userDetail:add")
    @PostMapping("/register")
    public R<Void> register(@Validated @RequestBody RegisterBody user) {
        registerService.register(user);
        return R.ok();
    }

    /**
     * 新增出租方账号
     */
//    @SaCheckPermission("all:register:add")
    @PostMapping("/registerLessor")
    public R<Void> registerLessor(@RequestBody UserRegisterBody user) {
        registerService.registerLessor(user);
        return R.ok();
    }

    /**
     * 出租方注册业务员账号
     */
//    @SaCheckPermission("lessor:register:add")
    @PostMapping("/register/salesman")
    public R<Void> registerSalesman(@Validated @RequestBody RegisterBody user) {
        registerService.registerSalesman(user);
        return R.ok();
    }

    /**
     * 新增出租方业务员账号
     */
//    @SaCheckPermission("lessor:userDetail:add")
    @PostMapping("/salesman")
    public R<Void> NewSalesman(@RequestBody UserRegisterBody user) {
        registerService.NewSalesman(user);
        return R.ok();
    }
}
